
#include "GameEngine.h"

//OpenGL headers
#include <gl\gl.h>			// Header File For The OpenGL32 Library
#include <gl\glu.h>			// Header File For The GLu32 Library
//#include <gl\glaux.h>		// Header File For The Glaux Library

#include <windows.h>

//(level 1 code)

class OpenGLRenderer : public IRenderer
{
    
    //Allow GameComponentFactory to access the private constructor
    friend class GameComponentFactory;
    
    bool m_bActive;
    bool m_bQuit;
    bool m_bFullscreen;
    int	m_iWidth, m_iHeight;
    
	//Window variables
	HGLRC		m_hRC;          //Permanent rendering context
	HWND		m_hWnd;         //Holds our window handle
	HINSTANCE	m_hInstance;    //Holds the instance of the application
	HDC			m_hDC;          //GDI device context
    
    void initGL();
    void killWindow();
    
private:
    
    //Constructor and destructor
    OpenGLRenderer(Game* pOwner) : IRenderer(pOwner), m_bActive(true), m_bQuit(false), m_bFullscreen(false), m_hDC(NULL), m_hRC(NULL), m_hWnd(NULL)        {}
    ~OpenGLRenderer()       { if (m_hWnd) killWindow(); }
    
    virtual bool init(String sTitle, int iWidth, int iHeight, int iBitsPerPixel, bool bFullscreen);
    virtual void resize(int iWidth, int iHeight);
    virtual bool update();
    
    virtual void renderScene();
    
    virtual bool isActive()         { return m_bActive; }
    virtual bool isQuit()           { return m_bQuit; }
    
public:
    
    //virtual void setColor();
    //virtual void drawTri(double fCoords[3]);
    
};
